package com.chenbei.common.util;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.chenbei.common.domain.vo.Pagination;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "分页工具类")
public class PaginationUtil {

    public static <T> Pagination<T> toPagination(IPage<T> page) {
        Pagination<T> pagination = new Pagination<>();
        pagination.setTotal(page.getTotal());
        pagination.setData(page.getRecords());

        return pagination;
    }
}
